﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace Mantenimiento.Models
{
    public class PLANTILLAMetadata
    {
        [MaxLength(100, ErrorMessage="Máximo 100 caractéres")]
        [Required(AllowEmptyStrings=false, ErrorMessage="Campo Obligatorio")]
        [Display(Name = "Nombre de Plantilla")]
        public string DESCRIPCION;

        [Display(Name = "Código")]
        public int PLANTILLA_ID;

        [Display(Name = "Régimen")]
        public string REGIMEN;

        [Display(Name = "Régimen")]
        public string REGIMENDES;

        [Display(Name = "Estado")]
        public string ESTADODES;
    }

    [MetadataType(typeof(PLANTILLAMetadata))]
    public partial class PLANTILLA
    {
        public IEnumerable<PLANTILLA_DETALLE> PlantillaDetalle
        {
            get;
            set;
        }            

        public string REGIMENDES
        {
            get
            {
                switch (this.REGIMEN)
                {
                    case "1":
                        return "POR TIEMPO";
                    case "2":
                        return "POR RECORRIDO";
                    default:
                        return "SIN VALOR";
                }
            }
        }

        public string ESTADODES
        { 
            get{
                switch(this.ESTADO)
                {
                    case "1":
                        return "ACTIVO";
                    default:
                        return "INACTIVO";
                }
            }
        }
    }
}